<template>
  <div class="configuration-container">
    <el-container>
      <el-header>
        <navbar />
      </el-header>
      <dashboard-title />
      <el-main>
        <component :is="currentRole" />
      </el-main>
    </el-container>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
import adminDashboard from './admin'
import editorDashboard from './editor'
import { Navbar } from '@/layout/components'
import DashboardTitle from '@/components/DashboardTitle'
import ResizeMixin from '@/layout/mixin/ResizeHandler'

export default {
  name: 'Configuration',
  components: { adminDashboard, editorDashboard, Navbar, DashboardTitle },
  mixins: [ResizeMixin],
  data() {
    return {
      currentRole: 'adminDashboard'
    }
  },
  computed: {
    ...mapGetters([
      'roles'
    ])
  },
  created() {
    if (!this.roles.includes('SuperAdmin')) {
      this.currentRole = 'editorDashboard'
    }
  }
}
</script>

<style lang="scss" scoped>
.configuration-container{
  height: 100vh;

  .el-container{
    height: 100%;

    .el-header{
      color: #fff;
      text-align: center;
      height: 50px !important;
    }

    .el-main {
      color: #fff;
      height: calc(100% - 50px);
      padding: 10px;
      z-index: 1;
    }
  }
}
</style>
